<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateStatInviteInfoTable extends Migration
{
    protected $connection = 'stat';

    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('stat_invite_info', function (Blueprint $table) {
            $table->increments('id');
            // $table->date('dt')->comment('统计日期');
            $table->unsignedInteger('invite_id')->default(0)->comment('邀请人ID');
            $table->unsignedSmallInteger('invited_num')->default(0)->comment('被邀请人总数');
            $table->unsignedInteger('recharge_rmb')->default(0)->comment('被邀请人充值金额');
            // $table->string('invited_ids', 800)->default('')->comment('邀请');
            $table->timestamps();
            $table->tinyInteger('flag')->default(1)->comment('记录状态');
            // $table->index('dt', 'dt');
            $table->index('invite_id', 'invite_id');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('stat_invite_info');
    }
}
